import 'package:flutter/material.dart';
import 'package:moose_app/ui/values/values.dart';

import 'common_right_arrow.dart';

class ATHCommonListItem extends StatelessWidget {
  final Widget title;

  final Widget trailing;

  final bool showDivider;

  final Function press;

  ATHCommonListItem(
      {this.title, this.trailing, this.showDivider = true, this.press});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        decoration: BoxDecoration(
            color: Colors.white,
            border: Border(
                bottom: BorderSide(
                    color: showDivider ? kColorF1 : Colors.transparent))),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Container(
              padding: EdgeInsets.symmetric(horizontal: kSize24),
              constraints: BoxConstraints(minHeight: kSize100),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  title,
                  Row(
                    children: <Widget>[
                      trailing != null ? trailing : Container(),
                      Padding(
                        padding: EdgeInsets.only(left: kSize8),
                        child: ATHCommonRightArrow(),
                      ),
                    ],
                  )
                ],
              ),
            ),
          ],
        ),
      ),
      onTap: press,
    );
  }
}
